/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package hu.sqlexpr;

/**
 *
 * @author trekan
 */
public class Condition implements Visitable {
    
    public static class ConditionBuilder {
        public static Condition cnd(String condition) {
            return new Condition(condition);
        }
    }
    
    protected String condition;
    protected Condition and;
    protected Condition or;
    protected boolean bool = true;
    protected Object binding;
    
    private Condition(String condition) {
        this.condition = condition;
    }
    
    public Condition and(Condition and) {
        this.and = and;
        return this;
    }

    public Condition or(Condition or) {
        this.or = or;
        return this;
    }

    public Condition bool(boolean bool) {
        this.bool = bool;
        return this;
    }

    public Condition bind(Object binding) {
        this.binding = binding;
        return this;
    }

    public void accept(Visitor visitor) throws SyntaxException {
        visitor.visit(this);
    }        
}
